﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace JinianNet.JNCms.Controllers
{
    public class UserController : ControllerBase
    {
        public ActionResult List(string item,int page)
        {
            int size = Config.Page.Size;
            var list = Data.DataAccess.CreateUsers().GetList(0,null,null, page,size);

            string home, pre, next;
            if (page > 1)
            {
                home = Url.Action("List", "User");
                pre = Url.Action("List", "User", new { item = item, page = page - 1 });

            }
            else
            {
                home = null;
                pre = null;
            }
            if (list.Count == size)
            {
                next = Url.Action("List", "User", new { item = item, page = page + 1 });
            }
            else
            {
                next = null;
            }
            ViewData["WebPage"] = JinianNet.Web.PageLinker.GetActionLinker(home, pre, next);
            return View(list);
        }
    }
}
